"""allow_null_workflow_id_in_products

Revision ID: 216bb1bd2e33
Revises: a1b2c3d4e5f6
Create Date: 2025-09-09 17:18:54.137056

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '216bb1bd2e33'
down_revision: Union[str, None] = 'a1b2c3d4e5f6'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(op.f('ix_ai_workflows_id'), 'ai_workflows', ['id'], unique=False)
    op.create_index(op.f('ix_ai_workflows_status'), 'ai_workflows', ['status'], unique=False)
    op.alter_column('products', 'detail_content',
               existing_type=mysql.TEXT(charset='utf8mb4', collation='utf8mb4_unicode_ci'),
               comment='详情图URL',
               existing_comment='详情页HTML内容',
               existing_nullable=True)
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('products', 'detail_content',
               existing_type=mysql.TEXT(charset='utf8mb4', collation='utf8mb4_unicode_ci'),
               comment='详情页HTML内容',
               existing_comment='详情图URL',
               existing_nullable=True)
    op.drop_index(op.f('ix_ai_workflows_status'), table_name='ai_workflows')
    op.drop_index(op.f('ix_ai_workflows_id'), table_name='ai_workflows')
    # ### end Alembic commands ###
